package com.puppet.building182.pojo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Result<T> {
private Integer code;
private String msg;
private T data;
public static <T> Result<T> ok() {
    return new Result<>(200,"操作成功",null);
}

    public static <T> Result<T> ok(T obj) {
        return new Result<>(200,"操作成功",obj);
    }

    public static <T> Result<T> ok(T obj,String msg) {
        return new Result<>(200,msg,obj);
    }


    public static <T> Result<T> fail() {
        return new Result<>(500,"操作失败",null);
    }


    public static <T> Result<T> fail(String msg) {
        return new Result<>(500,msg,null);
    }
}
